package roborally.model;

/**
 * An interface for objects that can hold a certain amount of energy.
 * 
 * @author Mathieu REYMOND
 * @author Joren VERSPEURT
 * 
 * @version 2.0
 *
 */
public interface IEnergyHolder {

	/**
	 * Gives the energy of the energyHolder
	 * 
	 */
	public Energy getEnergy();
	
	/**
	 * Add an amount of energy to this energyHolder
	 * 
	 * @param amount The amount to add
	 * 
	 * @pre ...
	 * 		| canHaveAsEnergy(getEnergy() + amount)
	 * @pre ...
	 * 		| amount >= 0
	 * 
	 * @post ...
	 * 		 | new.getEnergy() == this.getEnergy() + amount
	 */
	public void recharge(Energy amount);
	
	/**
	 * Transfer an amount of energy to another energyHolder
	 * 
	 * @param other The energyHolder that will receive energy
	 * 
	 * @param amount The amount of energy that will be transferred
	 * 
	 * @pre ...
	 * 		| amount >= 0
	 * @pre ...
	 * 		| canHaveAsEnergy(getEnergy() - amount)
	 * 
	 * @throws NullPointerException
	 * 		   | other == null
	 * 
	 * @post ...
	 * 		 | new.getEnergy() == this.getEnergy() - amount
	 * @effect ...
	 * 		   | other.recharge(amount)
	 */
	public void transferEnergy(IEnergyHolder other, Energy amount);
}
